﻿namespace WMS6.Web
{
    using System;
    using System.Data;
    using WMS6.Web.AnalyticsReportService2Ref;

    public class AnalyticsReportService2ClientProxy : BasePage
    {
        public DataSet GetBillingLoadDetailRptDataSet(BillingLoadDetailRptQueryEntity billingLoadDetailRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetBillingLoadDetailRptDataSet(billingLoadDetailRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetBillingProfitRptDataSet(InvoiceRptQueryEntity invoiceRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetBillingProfitRptDataSet(invoiceRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetDailyInvPalletRptDataSet(DailyInvPalletRptQueryEntity dailyInvPalletRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetDailyInvPalletRptDataSet(dailyInvPalletRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetDeliveryOrderRptDataSet(DeliveryOrderRptQueryEntity deliveryOrderRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetDeliveryOrderRptDataSet(deliveryOrderRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetEmployeeWorkRptDataSet(EmployeeWorkRptQueryEntity employeeWorkRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetEmployeeWorkRptDataSet(employeeWorkRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetGlobalHistoryStockRptDataSet(HistoryStockRptQueryEntity historyStockRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetGlobalHistoryStockRptDataSet(historyStockRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetHistoryStockRptDataSet(HistoryStockRptQueryEntity historyStockRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetHistoryStockRptDataSet(historyStockRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetInOutInv2RptDetailDataSet(InOutStockRptDetailQueryEntity inOutStockRptDetailQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetInOutInv2RptDetailDataSet(inOutStockRptDetailQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public static AnalyticsReportService2ClientProxy GetInstance()
        {
            return new AnalyticsReportService2ClientProxy();
        }

        public DataSet GetInvoiceRpt2DataSet(InvoiceRptQueryEntity invoiceRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetInvoiceRpt2DataSet(invoiceRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetInvoiceRptDataSet(InvoiceRptQueryEntity invoiceRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetInvoiceRptDataSet(invoiceRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetLoadingRptDataSet(LoadingRptQueryEntity loadingRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetLoadingRptDataSet(loadingRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetOperatorWorkRptDataSet(OperatorWorkRptQueryEntity operatorWorkRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetOperatorWorkRptDataSet(operatorWorkRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetRentWhDetailRptDataSet(RentWhDetailRptQueryEntity rentWhDetailRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetRentWhDetailRptDataSet(rentWhDetailRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetStatementRptDataSet(StatementRptQueryEntity statementRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetStatementRptDataSet(statementRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        public DataSet GetWorkClassRptDataSet(WorkClassRptQueryEntity workClassRptQueryEntity)
        {
            PubParasInfo pubParasInfo = this.InitPubParasInfo();
            DataSet ds = null;
            AnalyticsReportService2Client client = new AnalyticsReportService2Client("WSHttpBinding_IAnalyticsReportService2");
            try
            {
                ds = client.GetWorkClassRptDataSet(workClassRptQueryEntity, pubParasInfo);
                client.Close();
            }
            catch (Exception ex)
            {
                client.Abort();
                SysLog.GetInstance().LogProxyError(ex);
            }
            return ds;
        }

        private PubParasInfo InitPubParasInfo()
        {
            return new PubParasInfo { UserID = base.UserInfo.UserID, UserLanguage = base.UserInfo.Preference.Lang, CurrentWH = base.UserInfo.CurrentWH };
        }
    }
}

